﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Project_Origin
{
    public partial class PO_Support_Form : Form
    {
        public PO_Support_Form()
        {
            InitializeComponent();
        }

        private Point mousePoint = new Point();

        private void PO_Support_Form_MouseDown(object sender, MouseEventArgs e)
        {
            this.mousePoint.X = e.X;
            this.mousePoint.Y = e.Y;
        }

        private void PO_Support_Form_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.Top = Control.MousePosition.Y - mousePoint.Y + 13;
                this.Left = Control.MousePosition.X - mousePoint.X + 13;
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (this.Opacity >= 0.3)
                this.Opacity -= 0.3;
            else
            {
                timer1.Stop();
                this.Close();
                Environment.Exit(Environment.ExitCode);
            }
        }

        private void PO_Button_Exit_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void PO_MixNum_Button_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void PO_Button_Back_Click(object sender, EventArgs e)
        {
            this.Dispose();
            this.Close();
            PO_MainMenu pO_MainMenu = new PO_MainMenu();
            pO_MainMenu.Show();
        }

        private void PO_Support_Form_Load(object sender, EventArgs e)
        {
            string AppPath = Application.StartupPath;
            PrivateFontCollection privateFonts = new PrivateFontCollection();
            try
            {
                privateFonts.AddFontFile(AppPath + @"\Resources\站酷快乐体.ttf");//加载字体
                Font font = new Font(privateFonts.Families[0], 20);
                Font font1 = new Font(privateFonts.Families[0], 9);
                PO_Label.Font = font;
                label1.Font = font1;
                label2.Font = font1;
                label3.Font = font1;
            }
            catch
            {
                MessageBox.Show("字体不存在或加载失败\n程序将以默认字体显示", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
    }
}
